<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%--<%@ taglib prefix="s" uri="/struts-tags" %>--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <title>Fobia - Bootstrap 4 Web Application UI Kit</title>
    <!--favicon-->
    <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="assets/plugins/summernote/dist/summernote-bs4.css"/>
    <!-- simplebar CSS-->
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet"/>
    <!-- Bootstrap core CSS-->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <!-- animate CSS-->
    <link href="assets/css/animate.css" rel="stylesheet" type="text/css"/>
    <!-- Icons CSS-->
    <link href="assets/css/icons.css" rel="stylesheet" type="text/css"/>
    <!-- Sidebar CSS-->
    <link href="assets/css/sidebar-menu.css" rel="stylesheet"/>
    <!-- Custom Style-->
    <link href="assets/css/app-style.css" rel="stylesheet"/>

</head>
<body>


<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header text-uppercase">技术文档表</div>
                <div class="card-body">
                    <table class="table" style="text-align: center;">
                        <thead>
                        <tr>
                            <th style="width:25%">任务编号</th>
                            <th>类型</th>
                            <th>日期</th>
                            <th>文档</th>

                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="tdocument">
                            <tr>
                                <td class="middle-align">${tdocument.taskId}</td>
                                <td class="middle-align">${tdocument.type}</td>
                                <td class="middle-align">${tdocument.date}</td>
                                    <%--                        <td><iframe src="${tdocument.attachment}/<s:property value='fileAddress'/>" width="800" height="638" scroll="no"></iframe></td>--%>

                                <td>
                                    <a href="./doc?id=${tdocument.taskId}">${tdocument.attachment}</a>
                                    </iframe>
                                </td>
                                <td>

                                    <a href="./find?id=${tdocument.taskId}">
                                        <button class="btn btn-primary btn-lg waves-effect waves btn-sm"
                                                data-toggle="modal" data-target="#myModal">修改
                                        </button>
                                    </a>
                                    <button type="button" class="btn btn-warning waves-effect waves btn-sm"
                                            style="margin: 0px auto;" onclick="sweet('${tdocument.taskId}')">删除
                                    </button>
                                </td>
                            </tr>

                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div><!--End Row-->

</div>
<!-- End container-fluid-->

<!-- Bootstrap core JavaScript-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<!-- simplebar js -->
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<!-- sidebar-menu js -->
<script src="assets/js/sidebar-menu.js"></script>

<!-- Custom scripts -->
<script src="assets/js/app-script.js"></script>

<!--Data Tables js-->
<script src="assets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/dataTables.buttons.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.bootstrap4.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/jszip.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/pdfmake.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/vfs_fonts.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.html5.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.print.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.colVis.min.js"></script>
<script src="assets/plugins/summernote/dist/summernote-bs4.min.js"></script>
<!--Sweet Alerts -->
<script src="assets/plugins/alerts-boxes/js/sweetalert.min.js"></script>
<script>
    $('#summernoteEditor').summernote({
        height: 400,
        tabsize: 2
    });
</script>

<script>
    function sweet(data) {
        swal({
            title: "您确定吗?",			//弹出标题
            text: "该操作会删除该教师信息!",			//弹出文本
            icon: "警告",				//警告图标   还有success error  info  不填就是不显示，默认不显示
            buttons: true,
            dangerMode: true,
        })
            .then((willDelete) => {
                if (willDelete) {
                    console.log(data)
                    swal("你的文件已删除!", {
                        icon: "success",
                    });
                    console.log("1")

                    window.location.href = "delDoc?taskId=" + data; 	//直接跳转到首页
                    console.log("1")
                    //嵌成果方法
                } else {
                    swal("文件删除失败!");
                    //嵌失败方法
                }
            });
    }


    $(function () {

        $.ajax({
            url: 'listcoursejson',
            dataType: 'json',
            type: "post",
            error: function () {
            },
            success: function (data) {

                document.getElementById("Cname_1").remove();
                var course = data["course"];
                console.log("course.length:" + course.length)
                for (var aa = 0; aa < course.length; aa++) {
                    var cid = course[aa]["cid"];
                    console.log("cid:" + cid)
                    var cname = course[aa]["cname"];
                    console.log("cname:" + cname)
                    document.getElementById("Cname").innerHTML +=
                        ' <option value = "' + cid + '">' + cname + '</option>/n';
                }
            }

        })
    });


    function CkPro(id) {
        document.getElementById(id).remove();
    }

    //修改

</script>
</body>
</html>
